home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 15923 < prev    next >
Encoding:
Text File  |  1996-08-05  |  923 b   |  46 lines

  1. Path: news.easynet.co.uk!usenet
  2. From: dgo@easynet.co.uk (dgo)
  3. Newsgroups: comp.lang.c++
  4. Subject: Arrays of structures
  5. Date: 8 Apr 1996 21:01:11 GMT
  6. Organization: easynet
  7. Message-ID: <4kbuqo$n6n@lemon.easynet.co.uk>
  8. NNTP-Posting-Host: dgo.easynet.co.uk
  9. Mime-Version: 1.0
  10. Content-Type: Text/Plain; charset=US-ASCII
  11. X-Newsreader: WinVN 0.99.6
  12.  
  13. I'm stumped on a problem.
  14.  
  15. I've got a structure definition, say
  16.  
  17. struct example
  18. {
  19.     int a;
  20.     int b;
  21. };
  22.  
  23. which I want to declare an array of and initiallise. I thought it was 
  24. simple a case of
  25.  
  26. example test[3] = 
  27. {
  28.     { 3, 5 },
  29.     { 4, 6 },
  30.     { 5, 7 },
  31. };
  32.  
  33. and what documentation I have supports this. 
  34.  
  35. But my C++ compiler (MSVC 1.0) just collapses saying that it cant 
  36. convert the first parameter into a structure of type example.
  37.  
  38. What am I doing wrong ? ( nb/ I don't want a solution which simply 
  39. implements the structure members in separate arrays!)
  40.  
  41. thanks
  42.  
  43. daniel
  44.  
  45.  
  46.